package service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import entity.vo.CornVo;
import mapper.ScheduledMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import service.ScheduledService;

import java.util.List;

@Service
public class ScheduledServiceImpl extends ServiceImpl<ScheduledMapper,CornVo> implements ScheduledService {

    @Autowired
    private ScheduledMapper scheduledMapper;

    @Override
    public void setcorn(String time) {
        CornVo cornVo = new CornVo();
        cornVo.setCorn("0 0/"+time+" "+"* * * *");
        cornVo.setId(1);
        CornVo cornVo1 = scheduledMapper.selectById(1);
        if (cornVo1==null) {
            scheduledMapper.insert(cornVo);
        }else{
            scheduledMapper.updateById(cornVo);
        }
    }

}
